var arr = MVCFunctions.explode(",", values["UserId"]);
// This is the name of the multi check box or
// list select field, its value becomes arr
for (int i = 0; i < arr.Count(); i++)
{
var strInsert = String.Format("insert into DDK_Student (UserId) values ('{0}')", arr[i]);
var strInsert3 = String.Format("insert into DDK_Student (Draseis) values ('{0}')", arr[i]);
var strInsert4 = String.Format("insert into DDK_Student (Perigrafi) values ('{0}')", arr[i]);
var strInsert5 = String.Format("insert into DDK_Student (Monades) values ('{0}')", arr[i]);
var strInsert6 = String.Format("insert into DDK_Student (TimeStamp) values ('{0}')", arr[i]);
var strInsert7 = String.Format("insert into DDK_Student (Class) values ('{0}')", arr[i]);
var strInsert8 = String.Format("insert into DDK_Student (UserIdTeach) values ('{0}')", arr[i]); // add more fields from the add page to be inserted into database
Is not working. The entrys in the table is only the UserId and and the end it makes an entry with all the UserId that I select. Also i have a problem with the day and the Monades(is int). Thx for your help
K
kleanthis author12/10/2017
Solved
if (values["UserId"])
{
var arr = MVCFunctions.explode(",", values["UserId"]); // This is the name of the multi check box or
// list select field, its value becomes arr
var tom = values["Tomeis"];
// insert your var here for (int i = 0; i < arr.Count(); i++)
{
var strInsert = String.Format("insert into DDK_Student (UserId, Tomeis,...fields...) values ('{0}', '{1}',....no_of_var...)", arr[i], tom,...variables... );
// add more fields from the add page to be inserted into database